package com.burstly.lib.component.networkcomponent;

import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import com.burstly.lib.component.IBurstlyAdaptor;
import com.burstly.lib.feature.networks.IAdaptorFactory;
import com.burstly.lib.util.LoggerExt;
import com.burstly.lib.util.ManifestValidator.ValidationResults;
import com.burstly.lib.util.Utils;
import java.util.Map;

public abstract class AbstractAdaptorFactory
  implements IAdaptorFactory
{
  protected static final String CONTEXT = "context";
  private static final LoggerExt LOG = LoggerExt.getInstance();
  private static final String TAG = AbstractAdaptorFactory.class.getSimpleName();
  protected static final String VIEW_ID = "viewId";
  private final String mFactoryName;
  private final String mUsedSdkClassName;

  public AbstractAdaptorFactory(String paramString1, String paramString2)
  {
    this.mUsedSdkClassName = paramString1;
    this.mFactoryName = paramString2;
  }

  private boolean checkParameters(Object paramObject1, Object paramObject2)
  {
    if (paramObject1 == null)
    {
      LoggerExt localLoggerExt4 = LOG;
      String str4 = TAG;
      Object[] arrayOfObject4 = new Object[1];
      arrayOfObject4[0] = this.mFactoryName;
      localLoggerExt4.logError(str4, "viewId can not be null in factory {0}", arrayOfObject4);
      return false;
    }
    if (paramObject2 == null)
    {
      LoggerExt localLoggerExt3 = LOG;
      String str3 = TAG;
      Object[] arrayOfObject3 = new Object[1];
      arrayOfObject3[0] = this.mFactoryName;
      localLoggerExt3.logError(str3, "context can not be null in factory {0}", arrayOfObject3);
      return false;
    }
    if (!(paramObject1 instanceof String))
    {
      LoggerExt localLoggerExt2 = LOG;
      String str2 = TAG;
      Object[] arrayOfObject2 = new Object[1];
      arrayOfObject2[0] = this.mFactoryName;
      localLoggerExt2.logError(str2, "viewId must be a string in factory {0}", arrayOfObject2);
      return false;
    }
    if (!(paramObject2 instanceof Context))
    {
      LoggerExt localLoggerExt1 = LOG;
      String str1 = TAG;
      Object[] arrayOfObject1 = new Object[1];
      arrayOfObject1[0] = this.mFactoryName;
      localLoggerExt1.logError(str1, "context must be a Context instance in factory {0}", arrayOfObject1);
      return false;
    }
    return true;
  }

  public IBurstlyAdaptor createAdaptor(Map<String, ?> paramMap)
  {
    if (!isSdkAvailable());
    Object localObject1;
    Object localObject2;
    do
    {
      return null;
      localObject1 = paramMap.get("viewId");
      localObject2 = paramMap.get("context");
    }
    while (!checkParameters(localObject1, localObject2));
    return createInstance((Context)localObject2, (String)localObject1);
  }

  protected abstract IBurstlyAdaptor createInstance(Context paramContext, String paramString);

  public void destroy()
  {
  }

  public void initialize(Map<String, ?> paramMap)
    throws IllegalArgumentException
  {
  }

  protected boolean isSdkAvailable()
  {
    return Utils.isSdkAvailable(this.mUsedSdkClassName, this.mFactoryName);
  }

  public String toString()
  {
    return this.mFactoryName;
  }

  public abstract ManifestValidator.ValidationResults validateManifest()
    throws PackageManager.NameNotFoundException;
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.AbstractAdaptorFactory
 * JD-Core Version:    0.6.2
 */